<template>
    <div class="em-spm-topTable">
        <el-table
        ref="receiveTable"
        size="mini"
        :data="resData"
        style="width: 100%"
        height="180"
        highlight-current-row

        >
        <!-- <el-table-column type="selection" width="40"> </el-table-column> -->
        <el-table-column type="index" label="序号" width="50" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="aoCode" label="AO编码" width="150" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="packageCode" label="工作包编码" width="150" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="itemCode" label="物料编码" width="150" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="itemName" label="物料名称" width="150" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="itemQty" label="需求数量" width="150" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="startPlaneNo" label="架次" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="batchNo" label="批次" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="repartAss" label="装配图号" width="150" :show-overflow-tooltip="true"> </el-table-column>
        
      </el-table>
        <!-- 分页 -->
        <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="pageNumber"
            :page-sizes="[1,10,20,50,100]"
            :page-size="pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="totalCount">
        </el-pagination>
    </div>
</template>
<script>
import { smSmgtaskLogInfo } from "@/utils/api.js";
export default {
    name:"SpmLogTable",
    data(){
        return{
             // 当前页数
            pageNumber: 1,
            // 数据总个数
            totalCount: 0,
            // 返回的数据数组
            resData: [],
            // 每页数据个数
            pageSize: 20
            // 确认列表高亮参数
            // stableIndex: 0

        }
    },
    methods:{
        // // 单选
        // tableCurrentChange(val) {
        //     this.currentRow = val;
        //     // msTaskAoId 传给LastTable进行查询数据
        //     this.$bus.$emit('smSmanTopMidInfo',val.msTaskAoId)
        // },
        // // 勾选
        // handleSelectionChange(val){
        //     console.log('勾选',val)
        //     // 传给首页 gzb入库 回库 hcx入库
        //     this.$bus.$emit('smSmanGzbInfo',val)
        // },
       // 分页---每页数据条数---传给TopSearch
        handleSizeChange(val){
            this.pageSize = val;
            smSmgtaskLogInfo({
                pageParameter: {
                rows: this.pageSize,
                page: this.pageNumber,
                },
            }).then((res) => {
                this.resData = res.data.responseBody.result;
                this.totalCount = res.data.responseBody.pageParameter.totalCount;
                console.log('任务日志列表',res)
            });
        },
        // 分页---页数---传给TopSearch
        handleCurrentChange(val) {
            this.pageNumber = val;
            smSmgtaskLogInfo({
                pageParameter: {
                rows: this.pageSize,
                page: this.pageNumber,
                },
            }).then((res) => {
                this.resData = res.data.responseBody.result;
                this.totalCount = res.data.responseBody.pageParameter.totalCount;
                console.log('任务日志列表',res)
            });
        },
    },
    mounted() {

         // 接收Top表给Last表的msTaskAoId 进行查数据
         this.$bus.$on('smSmanTopMidInfo',(e)=>{
            this.topLastInfo = e
            smSmgtaskLogInfo({
                searchParams:{
                    msTaskAoId:this.topLastInfo
                },
                pageParameter: {
                    rows: this.pageSize,
                    page: this.pageNumber
                },
            }).then((res) => {
                console.log('物料信息',res)
                this.resData = res.data.responseBody.result;
                this.totalCount = res.data.responseBody.pageParameter.totalCount;
            });
        })
        // 接收TOp左传参查数据
        // this.$bus.$on('smSmnTopLeftToRight',(e)=>{
        //     this.msTaskPackageId = e
        //     smSmgtaskLogInfo({
        //         msTaskAoId:this.msTaskAoId,
        //         pageParameter: {
        //         rows: this.pageSize,
        //         page: this.pageNumber,
        //         },
        //     }).then((res) => {
        //         this.resData = res.data.responseBody.result;
        //         this.totalCount = res.data.responseBody.pageParameter.totalCount;
        //         console.log('任务日志列表',res)
        //     });
        // }) 
  }
}
</script>
<style scoped>
.em-spm-topTable {
    text-align: center;
}
</style>